﻿# -*- coding: utf-8 -*-
"""
Created on Wed Oct 25 11:18:49 2017
@author: heting
"""
# 以需要的时间间隔执行某个命令 
import time, os ,datetime
    
def re_exe(cmd_list, inc = 3): 
    cnt_list=[]
    while True: 
        ts_start = datetime.datetime.now()
        if ts_start.hour==0 and len(cnt_list)==0 and ts_start.minute>=5:
            time.sleep(3)
            cnt_list.append(1)
            for cmd in cmd_list:
                os.system(cmd);
                print(cmd+' insert sucess!--->%s'%ts_start.strftime('%Y%m%d %H:%M:%S'),'\n')
        if ts_start.hour==1:
            cnt_list = []
        time.sleep(inc)
        
cmd_list = ['python updateData.py','python approvalLogs.py','python xc_risk.py']
re_exe(cmd_list, 60)